<template>
    <div>
        <!-- 面包屑导航 -->
        <el-breadcrumb separator-class="el-icon-arrow-right">
        <el-breadcrumb-item :to="{ path: '/welcome' }">首页</el-breadcrumb-item>
        <el-breadcrumb-item>数据统计</el-breadcrumb-item>
        <el-breadcrumb-item>数据报表</el-breadcrumb-item>
        </el-breadcrumb>
        <el-card>
            <div id="main" style="width:750px;height:400px;"></div>
        </el-card>
    </div>
</template>

<script>
import echarts from 'echarts'
export default {
  data() {
    return {

    }
  },

  created() {

  },
  mounted(){
    this.initEcharts();
  },
  methods: {
    async initEcharts(){
       
        //在页面dom元素加载完毕之后执行的钩子函数mounted
    const {data:res}=await this.$axios.get('reports/type/1')
    res.data.xAxis[0].boundaryGap=false;//去掉两边留白
    res.data.tooltip={
        trigger: 'axis',
        axisPointer: {
            type: 'cross',
            label: {
                backgroundColor: '#6a7985'
            }
        }
    }
    res.data.title= {
        text: '数据统计'
    }
         // 基于准备好的dom，初始化echarts实例
    var myChart = echarts.init(document.getElementById('main'))
    // 使用获取的数据展示图表
    myChart.setOption(res.data)
    }
  }
};
</script>

<style scoped lang='less'>

</style>
